package com.example.address.controller;

import com.example.address.DTO.LocationResultAddress;
import com.example.address.service.AddressGetter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class controller {

    @Autowired
    private AddressGetter addressGetter;

    @GetMapping("/getResultAddressById")
    private @ResponseBody LocationResultAddress
    getLocationAddressById(@RequestParam("id") Integer id) {
        return addressGetter.getResultAddressById(id);
    }

    @GetMapping("/getResultAddressByBill")
    private @ResponseBody List<LocationResultAddress>
    getLocationAddressByBill(@RequestParam("bill") String bill) {
        return addressGetter.getResultAddressByBill(bill);
    }

    @GetMapping("/getCacheResultAddressById")
    private @ResponseBody LocationResultAddress
    getCacheResultAddressById(@RequestParam("id") Integer id) {
        return addressGetter.getCacheResultAddressById(id);
    }

    @GetMapping("/getCacheResultAddressByBill")
    private @ResponseBody List<LocationResultAddress>
    getCacheLocationAddressByBill(@RequestParam("bill") String bill) {
        return addressGetter.getCacheResultAddressByBill(bill);
    }
}
